/**
 * Created by Administrator on 15-11-2.
 */
window.onload=function() {
    $(".log-fb").on("click", function () {
        var url = getUrl();
        var userId = getUserId();
        var star= $("#star li.on").length;
        var comment = $("#comment").val();
        var urlList = getPics();
        var cameraId= $.getUrlParam("cameraId");
        $.jsonp({
            url: 'http://'+url+'/api/mapline/comment',
            data: {star:star,comment:comment,cameraId:cameraId,urlList:urlList,userId:userId},
            callbackParameter: "callback",
            success: function (data, textStatus, xOptions) {
            },
            error: function (xOptions, textStatus) {
            }
        });
    });
    var oStar = document.getElementById("star");
    var aLi = oStar.getElementsByTagName("li");
    var oUl = oStar.getElementsByTagName("ul")[0];
    for (i = 1; i <= aLi.length; i++){
        aLi[i - 1].index = i;
        //鼠标移过显示分数
        aLi[i - 1].onmouseover = function (){
            fnPoint(this.index);
        };
    }
    //评分处理
    function fnPoint(iArg){
        //分数赋值
        iScore = iArg ;
        for (i = 0; i < aLi.length; i++) aLi[i].className = i < iScore ? "on" : "";
    }

}


function getPics(){
    var imgs=$(".ppt img");
    var paths=[];
    $.each(imgs,function(index,ele){
        paths.push($(ele).attr('src'));
    })
    var paths=paths.join(",");
    return paths;
}